from django.db import models

# Create your models here.


class Student(models.Model):
    s_name = models.CharField(max_length=16)


class Person(models.Model):
    p_name = models.CharField(max_length=16)
    p_sex = models.BooleanField(default=False)


class IDCard(models.Model):
    id_num = models.CharField(max_length=18,unique=True)
    id_person = models.OneToOneField(Person,null=True,blank=True)


class Animal(models.Model):
    a_name = models.CharField(max_length=16)
    # 不会在数据库中生成映射表，如果生成映射表会使数据库臃肿，效率降低
    class Meta:
        abstract = True


class Cat(Animal):
    c_eat = models.CharField(max_length=32)


class Dog(Animal):
    d_legs = models.IntegerField(default=4)
